home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Rand() Function
- Date: 21 Mar 1996 16:09:49 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4irv0d$4mq@sparcserver.lrz-muenchen.de>
- References: <4iqltj$40g@news1.sympatico.ca>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- Gisele Swinson <gisele.swinson@sympatico.ca> writes:
-
- >How do I get a random number from a "SET" of numbers.
-
- >e.g.
-
- > I want a random number from this set:
-
- > 2, 4, 6, 8, 10
-
- >It seems so simple but I can't find anything in my text how to do this.
-
- Step 1: Get a random number from {0, 1, 2, 3, 4}. The FAQ explains how
- to do this.
- Step 2: Add One.
- Step 3: Multiply by 2.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-
-